<?php include('header.php');?>
<?php 
$id = $_GET['id'];
//จัดการตาราง reservation_session
mysql_query("DELETE FROM reservation_session");
$dQuery = mysql_query("SELECT reservation_checkin FROM reservation WHERE reservation_detail_id='$id' GROUP BY reservation_checkin ");
	$rSNum=0;
while($dRow = mysql_fetch_array($dQuery)){
	$rSQuery = mysql_query("SELECT room_id,reservation_checkin,reservation_detail_id,reservation_status FROM reservation WHERE reservation_checkin='".$dRow['reservation_checkin']."' ");
	while($rSRow = mysql_fetch_array($rSQuery)){
		$rSNum++;
		mysql_query("INSERT INTO reservation_session (reservation_session_id,room_id,reservation_checkin,reservation_detail_id,reservation_status) VALUES ('$rSNum','".$rSRow['room_id']."','".$rSRow['reservation_checkin']."','".$rSRow['reservation_detail_id']."','".$rSRow['reservation_status']."')");
	}
}

echo "<script>window.location='room_edit_detail.php?id=".$id."'</script>";
?>
<?php include('footer.php');?>
